<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        var a="hello world";
        /*获取字符串的长度 length*/
        var len=a.length;
        /*添加*/
        var add=a.concat(" add");
        console.log(add);
        /*查询
            1.charAt(index)//获取在指定下标的字符
            2.indexOf(value)//检索字符串出现的位置没有该字符返回-1
            3.stringObject.slice(start,end)
            4.stringObject.substr(start,length)
            5.stringObject.substring(start,stop)
        */
        var b=a.charAt(1);
        console.log(b);
        var c=a.indexOf("h");
        console.log(c);
        var d = a.slice(0,2);
        console.log(d); //”he”
        var e=a.substr(0,5);
        
    </script>
</body>
</html>